#include <linux/module.h>
#include <linux/slab.h>
MODULE_LICENSE("GPL");
unsigned char *kmallocmem1;
unsigned char *kmallocmem2;
static int __init mem_module_init(void)
{
    printk("Startkmalloc!\n");
    kmallocmem1 = (unsigned char *)kmalloc(1024, GFP_KERNEL);
    if (kmallocmem1 != NULL)
    {
        printk(KERN_ALERT "kmallocmem1 addr = %lx\n", (unsigned long)kmallocmem1);
    }
    else
    {
        printk("Failedtoallocatekmallocmem1!\n");
    }
    kmallocmem2 = (unsigned char *)kmalloc(8192, GFP_KERNEL);
    if (kmallocmem2 != NULL)
    {
        printk(KERN_ALERT "kmallocmem2 addr = %lx\n", (unsigned long)kmallocmem2);
    }
    else
    {
        printk("Failedtoallocatekmallocmem2!\n");
    }
    return 0;
}
static void __exit mem_module_exit(void)
{
    kfree(kmallocmem1);
    kfree(kmallocmem2);
    printk("Exitkmalloc!\n");
}
module_init(mem_module_init);
module_exit(mem_module_exit);